/*
    Project Milestone 3
    by Lorenzo Miori [Lorenzo.Miori@stud-inf.unibz.it,
    Matteo Angriman [Matteo.Angriman@stud-inf.unibz.it],
    Nick Preda [Nicolae.Preda@stud-inf.unibz.it]
*/

package DB;

import java.sql.Connection;
import java.util.HashMap;

/**
 * Implementation of the generic table interface for
 * the table "Hotel"
 * @author Lorenzo
 */
public class HotelDB extends GenericTableInterface {
    
    /* Attribute names to be used in SQL query */
    public static final String HOTEL_TABLE_NAME = "Hotel";
    public static final String HOTEL_ID = "hotel_id";
    public static final String HOTEL_NAME = "hotel_name";
    public static final String HOTEL_ADDRESS = "hotel_address";
    public static final String HOTEL_STARS_RATE = "stars_rate";
    public static final String HOTEL_ORDERING[] = {HOTEL_ID, HOTEL_NAME, HOTEL_ADDRESS, HOTEL_STARS_RATE};
    /* Attribute types */
    public static final int[] HOTEL_TYPES = {INT, STRING, INT, INT};
    
    public HotelDB(Connection dbConnection) {
        /* The generic interface wants to know some stuff...
         * Basic datatypes, the elementary attribute names
         */
        super(dbConnection, HOTEL_TYPES, HOTEL_ID, HOTEL_TABLE_NAME, HOTEL_ORDERING);
    }
    
    public static String formatHotel(HashMap<String, String> addrData) {
        return addrData.get(HotelDB.HOTEL_NAME) + ", " +
               addrData.get(HotelDB.HOTEL_STARS_RATE) + "*";
    }
    
}